package cn.tedu.springboot2106;

import cn.tedu.springboot2106.bean.Saw;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;

/**
 * SpringBoot 的启动类
 * 1. 回自动初始化Spring容器
 * 2. 启动类本身就是配置类
 * 3. SpringBoot 自动提供了单元测试支持
 * @SpringBootApplication 是一个复合注解, 
 *  是一组原注解组合的
 */
@SpringBootApplication
//自定义的组件扫描, 扫描cn.tedu.bean和其子包
//Component: 组件   Scan: 扫描
@ComponentScan(
        basePackages = {"cn.tedu.bean","cn.tedu.springboot2106"})
public class Springboot2106Application {

    public static void main(String[] args) {
        SpringApplication.run(Springboot2106Application.class, args);
    }

    @Bean
    public HelloWorld helloWorld(){
        return new HelloWorld();
    }

    @Bean //BeanID：demoBean1
    public DemoBean demoBean1(){
        return new DemoBean();
    }

    @Bean
    public Saw saw1(){
        return new Saw();
    }
}
